home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Demos / Extend 3.0 Demo / Demo Libraries / Demo Engineering Lib / Demo Engineering Lib.rsrc / MODL_20894_Delay Line < prev    next >
Encoding:
Text File  |  1994-06-22  |  1.7 KB  |  67 lines

  1. ** this script uses the delay functions
  2.  
  3. integer    num, i;
  4. real    delArray[];
  5.  
  6. on simulate
  7. {
  8. con2out = delay(delArray, con1in);
  9.  
  10. ** sysGlobal2 is the file reference number for the DEBUG TRACE
  11. if( sysGlobal2 != 0.0 )    ** 0 is error, check for open file for TRACE
  12.     {
  13. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  14.     fileWrite(sysGlobal2,"Delay Line                  block number "+(MyBlockNumber())+".  Current Time:"+currentTime+".","",True);
  15.     if(getBlockLabel(myBlockNumber()) != "")
  16.         fileWrite(sysGlobal2,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  17.     fileWrite(sysGlobal2,"     Input = "+con1In,"",True);
  18.     fileWrite(sysGlobal2,"     Output = "+con2Out,"",True);
  19.     fileWrite(sysGlobal2," ","",True);
  20.     }
  21. }
  22.  
  23. on endSim
  24. {
  25. disposeArray(delArray);
  26.  
  27. ** sysGlobal1 is the file reference number for the TEXT REPORT
  28. if( sysGlobal1 != 0.0 ) ** 0 is error, check for open file for REPORT
  29.     {
  30. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  31.     fileWrite(sysGlobal1,"Delay Line                  block number "+(MyBlockNumber()),"",True);
  32.     if(getBlockLabel(myBlockNumber()) != "")
  33.         fileWrite(sysGlobal1,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  34.     fileWrite(sysGlobal1,"     Delay Time = "+delayTime,"",True);
  35.     if( comments != "" )
  36.         fileWrite(sysGlobal1,"     Comments = "+comments,"",True);        
  37.     fileWrite(sysGlobal1," ","",True);
  38.     }
  39. }
  40.  
  41. on checkdata
  42. {
  43. if (novalue(delayTime))
  44.     abort;
  45. }
  46.  
  47.  
  48. on stepsize
  49. {
  50. ** deltaTime should be delayTime or smaller
  51. ** Extend ignores negative or zero deltaTime values!
  52. deltaTime = delayTime;
  53. }
  54.  
  55.  
  56. on initsim
  57. {
  58. delayInit(delArray, delayTime);
  59. }
  60.  
  61.  
  62. on createmodule
  63. {
  64. delayTime = 0.0;
  65. }
  66.  
  67.